<?php  
echo $this->session->flash(); 
if(!empty($associatedUsers)){
    $this->Paginator->options(array(
        'update' => '#associatedUser',
        'evalScripts' => true,
        'url' => array('controller' => 'Users', 'action' => 'mydashboard')
    ));
} ?>

<div class="file" id="List">
    <table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#686550">
        <tr class="heading"  style="background: #708089;">
            <td width="6%" valign="top" align="left"><?php echo __('S.NO') ?></td>
            <td valign="top"  align="left"><?php echo $this->Paginator->sort('e_name', __('E_NAME', true)); ?></td>
            <td valign="top"  align="left"><?php echo $this->Paginator->sort('email', __('EMAIL', true)); ?></td>
            <td valign="top"  align ="left"><?php echo $this->Paginator->sort('role_id', __('ROLE', true)); ?></td>
            <td valign="top"  align ="left"><?php echo $this->Paginator->sort('on_leave', __('ON_LEAVE', true)); ?></td>
        </tr>
        <?php
        if (isset($associatedUsers) && count($associatedUsers) > 0) {
            $i = 0;
            foreach ($associatedUsers as $arrayDetail) {
                ?>
                <tr class="heading2" bgcolor="#ffffff">
                    <td>&nbsp;<?php echo $i + 1 ?></td>
                    <td>&nbsp;<?php echo $arrayDetail['User']['e_name']; ?></td>
                    <td>&nbsp;<?php echo $arrayDetail['User']['email']; ?></td>
                    <td>&nbsp;<?php echo $roles[$arrayDetail['User']['role_id']]; ?></td>
                    <td>&nbsp;<?php echo ($arrayDetail['User']['on_leave']) ? __('YES') : __('NO'); ?></td>                    
                </tr>  
                <?php
                $i++;
            }
        }
        ?>
        <tr>
            <td colspan="5" bgcolor="#ffffff" align="center">
                <div class="pagination">            
                    <?php
                    if (!empty($associatedUsers)) {
                        echo $this->Element('pagination');
                    } else {
                        echo __("NO_RECORD_MESSAGE");
                    }
                    ?>              
                </div>
            </td>
        </tr>
    </table>
</div>
<?php echo $this->Js->writeBuffer();?>